package com.gzk.hrm.domain;

import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * <p>
 * 登录表
 * </p>
 *
 * @author jake.Chen
 * @since 2022-02-10
 */
@TableName("t_login")
@Data
public class Login extends Model<Login> {

    public static final int TENANT = 0;
    public static final int PLANTFORM = 1;
    public static final int USER = 2;


    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @NotEmpty(message = "用户名不能为空")
    private String username;

    @Size(min = 2,max = 16,message = "密码格式不对")
    private String password;
    /**
     * 0是平台，1是机构 ， 2是前台
     */
    private Integer type;
    private Boolean enabled;
    @TableField("account_non_expired")
    private Boolean accountNonExpired;
    @TableField("credentials_non_expired")
    private Boolean credentialsNonExpired;
    @TableField("account_non_locked")
    private Boolean accountNonLocked;
    @TableField("client_id")
    private String clientId;
    @TableField("tenant_id")
    private Long tenantId;
    @TableField("tenant_name")
    private String tenantName;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
